<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/common/tags.jsp" %>

<div class="am-u-sm-12">
    <section data-am-widget="accordion" class="am-accordion am-accordion-gapped"
             data-am-accordion='{  }'>
        <dl class="am-accordion-item am-active">
            <dt class="am-accordion-title"><span class="am-icon-search"></span> 查询</dt>
            <dd class="am-accordion-bd am-collapse am-in">
                <div class="am-accordion-content">
                    <form id="_searchForm">
                    <div class="am-u-sm-3">
                        公司名称：<input type="text" name="name" placeholder="公司名称" >
                    </div>
                    <div class="am-u-sm-3">帐号状态：
                        <select name="state">
                            <option value="">请选择...</option>
                            <option value="0">冻结</option>
                            <option value="1">正常</option>
                        </select>
                    </div>
                    <div class="am-u-sm-3">认证状态：
                        <select name="identification">
                            <option value="">请选择...</option>
                            <option value="0">未认证</option>
                            <option value="1">已认证</option>
                        </select>
                    </div>
                    <div class="am-u-sm-3 am-u-end"><button type="button" class="am-btn am-btn-xs am-btn-success" onclick="_search()">查询</button></div>
                    <div class="am-cf"/>
                    </form>
                </div>
            </dd>
        </dl>
    </section>

    <!--操作按钮-->
    <!--<div class="am-u-md-6 am-cf">
        <div class="am-fl am-cf">
            <div class="am-btn-toolbar am-fl">
                <div class="am-btn-group am-btn-group-xs">
                    <button type="button" type="button" class="am-btn am-btn-success"><span class="am-icon-plus"></span> 新建商家</button>
                </div>
            </div>
        </div>
    </div>-->


    <table class="am-table am-table-striped am-table-hover table-main">
        <thead>
        <tr>
            <th class="table-id">NO</th>
            <th class="table-title">公司名称</th>
            <th class="table-title">联系人</th>
            <th class="table-title">电话</th>
            <th class="table-title">手机</th>
            <th class="table-title">帐号状态</th>
            <th class="table-title">认证状态</th>
            <th class="table-set">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${pager.records}" var="item" varStatus="status">
            <tr>
                <td>${status.index+1}</td>
                <td>${item.name}</td>
                <td>${item.contactName}</td>
                <td>${item.contactTel}</td>
                <td>${item.contactPhone}</td>

                <td>
                    <c:if test="${item.state == 0 }">
                        冻结
                    </c:if>
                    <c:if test="${item.state == 1 }">
                        正常
                    </c:if>
                </td>
                <td>
                    <c:if test="${item.identification == 0 }">
                        未认证
                    </c:if>
                    <c:if test="${item.identification == 1 }">
                        已认证
                    </c:if>
                </td>
                <td>
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                            <button type="button" class="am-btn am-btn-default am-btn-xs am-text-secondary"
                                    onclick="audit(${item.id})">
                                <span class="am-icon-pencil-square-o"></span> 帐号审核
                            </button>
                        </div>
                    </div>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div id="kkpager"></div>
</div>

<script>

    $(function () {
        ishop.kkpager(${pager.pageNo},${pager.pageCount},${pager.totalRecord},selectPage);
        $("input[name=name]").val('${param.name}');
        $("select[name=state]").val('${param.state}');
        $("select[name=identification]").val('${param.identification}');

    });
    function selectPage(n){
        var queryString = $('#_searchForm').formSerialize();
        location.href = "${ctx}/admin/seller/index.do?"+queryString+"&pageNo=" + n;
    }

    function _search(){
        var queryString = $('#_searchForm').formSerialize();
        var url ="${ctx}/admin/seller/index.do?"+queryString;
        location.href = url;
    }

    function audit(id) {
        location.href = "${ctx}/admin/seller/edit.do?pageNo=${pager.pageNo}&id=" + id;
    }
</script>


